﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RMS.Web.Shell.Presenter;
using RMS.Web.Shell.View;
using RMS.Utils.MVP;

namespace RMS.WebPages.Reception
{
    public partial class GetPriceView : Page<GetPricePresenter>, IGetPriceView
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ddlRadiologyCode.DataSource = this.Presenter.GetRadiologyTypes();
                ddlRadiologyCode.DataTextField = "RadiologyCode";
                ddlRadiologyCode.DataValueField = "RadiologyCode";
                ddlRadiologyCode.DataBind();
                ListItem item = new ListItem();
                item.Text = "None";
                item.Value = "";
                item.Selected = true;
                ddlCompanyName.DataSource = this.Presenter.getCompanyNams();
                ddlCompanyName.DataTextField = "CompanyName";
                ddlCompanyName.DataValueField = "ContractId";
                ddlCompanyName.DataBind();
                ddlCompanyName.Items.Add(item);

            }
        }

        protected void btnGetPrice_Click(object sender, EventArgs e)
        {
            if (ddlCompanyName.SelectedValue != "")
                txtprice.Text = this.Presenter.getPrice(ddlRadiologyCode.SelectedValue, Convert.ToInt32(ddlCompanyName.SelectedValue)).ToString();
            else
                txtprice.Text = this.Presenter.getPrice(ddlRadiologyCode.SelectedValue, null).ToString();

        }
    }
}